﻿namespace ExcelAutomator
{
	public class ExecutionResult
	{
		public string Message { get; set; }
		public bool Success { get; set; }
		public ExecutionContext Context { get; set; }


		public ExecutionResult(string message, bool success, ExecutionContext context)
		{
			Message = message;
			Success = success;
			Context = context; //TODO still needed???
		}


		public static ExecutionResult CreateSuccess(string message, ExecutionContext context)
		{
			return new ExecutionResult(message, true, context);
		}

		public static ExecutionResult CreateFailure(string message, ExecutionContext context)
		{
			return new ExecutionResult(message, false, context);
		}

		public override string ToString()
		{
			return string.Format("{0} -> {1}", Message, Success == true ? "Success" : "Failure");
		}

	}
}
